import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { FilesProvider } from '../../providers/files/files';
import { ImagesProvider } from '../../providers/images/images';
/**
 * Generated class for the HomePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
	selector: 'page-home',
	templateUrl: 'home.html',
})
export class HomePage {

	private inputViewModel = { upload: '' };

	constructor(
		public navCtrl: NavController,
		public navParams: NavParams,
		public files: FilesProvider,
		public images: ImagesProvider) {}

	ionViewDidLoad() {
		console.log('ionViewDidLoad HomePage');
	}

	picupload() {
		//图片上传
		this.files.showPicUpload().then(file => {
			this.inputViewModel.upload = file['data'];
		}, fail => {

		});
	}
	
	doshow(){
		this.images.showGallery(
			[{url: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=285340935,1098169618&fm=200&gp=0.jpg", type: "png"},
			{url: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=285340935,1098169618&fm=200&gp=0.jpg", type: "png"}],1);
	}
	
	openchat(){
		this.navCtrl.push("ChatPage");
	}
}